package com.kl.feign;

import com.kl.domain.OrderDTO;
import com.kl.domain.WaybillDTO;
import com.kl.em.Result;
import com.kl.feign.fallback.OrderServiceFeignFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "kunlun-order-service-b",fallback = OrderServiceFeignFallback.class)//服务名找项目
public interface OrderServcieFeign {

    //订单表增加接口
    @PostMapping("/order/addOrder")
    Result<List<Long>> addOrder(@RequestBody List<OrderDTO> orders);

    //订单表修改接口
    @PutMapping("/order/updateOrder")
    Result<OrderDTO> updateOrder(@RequestBody OrderDTO orderDTO);

    //定单表查询接口
    @GetMapping("/order/findOrderById/{id}")
    Result<OrderDTO> findOrderById(@PathVariable("id") Long id);

    //订单表分页查询接口
    @GetMapping("/order/{pageNumber},/{pageSize}")
    Result<List<OrderDTO>> findAll(@PathVariable("pageNumber") Integer pageNumber, @PathVariable("pageSize") Integer pageSize);

    //运单表状态模糊查询接口
    @GetMapping("/waybill/likeWaybill/{status}")
    Result<List<WaybillDTO>> likeWaybill(@PathVariable("status") String status);

    //运单表修改接口
    @PutMapping("/waybill/updateWaybill")
    Result updateWaybill(@RequestBody WaybillDTO waybillDTO);


    //运单表增加接口
    @PostMapping("/waybill/addWaybill")
    Result addWaybill(@RequestBody WaybillDTO waybillDTO);

    //运单表更新信息接口
    @PutMapping("/waybill/updateUpdateInformation")
    Result updateUpdateInformation(@RequestParam Long waybillId,@RequestParam String information,@RequestParam String status);

    //运单表删除接口
    @DeleteMapping("/waybill/deleteWaybill/{waybillId}")
    Result deleteWaybill(@PathVariable("waybillId") Long waybillId);

    //根据支付宝订单号修改订单接口
    @PutMapping("/order/updateOrderStatus")
    Result updateOrderAlyOrderNumber(@RequestParam String serialNumber,@RequestParam String alyOrderNumber);

    //运单表id查询接口
    @GetMapping("/waybill/findWaybill/{waybillId}")
    Result<WaybillDTO> findWaybill(@PathVariable("waybillId") Long waybillId);

    //电话号码查询运单表接口
    @GetMapping("/waybill/findWaybillByPhone/{consigneePhone}")
    Result<List<WaybillDTO>> findWaybillByPhone(@PathVariable("consigneePhone") String consigneePhone);


    //通过手机号查询订单
    @GetMapping("/waybill/findOrdertoPhone")
    Result<List<OrderDTO>> findOrdertoPhone(@RequestParam String senderPhone);

    //通过订单id查询运单
    @PostMapping("/waybill/findWaybillByOrderId")
    Result<List<WaybillDTO>> findWaybillByOrderId(@PathVariable("waybillId") Long orderId);

    @GetMapping("/waybill/selectById")
    Result<WaybillDTO> selectById(@RequestParam Long waybillId);

    //通过运单是否装车查询运单
    @GetMapping("/waybill/selectByZhuang")
    Result<List<WaybillDTO>> selectByZhuang(@RequestParam Integer zhuangche,@RequestParam Long logisticsId);

    //通过运单id查询
    @GetMapping("/waybill/testById")
    Result<WaybillDTO> testById(@RequestParam Long id);

    @GetMapping("/waybill/selectbyId111")
    Result<WaybillDTO> selectbyId(@RequestParam Long waybillId);
}
